package com.squirrel.michale;

/**
 * TODO function description
 *
 * @author m30026548
 * @since 2025-04-10
 */
public class Day20250410_LeetCode002109 {


    public String addSpaces(String s, int[] spaces) {
        StringBuilder result = new StringBuilder(s.length() + spaces.length);
        int j = 0;
        for (int i = 0; i < s.length(); i++) {
            if (j < spaces.length && spaces[j] == i) {
                result.append(' ');
                j++;
            }
            result.append(s.charAt(i));
        }
        return result.toString();
    }
}
